{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "source": [
    "# Before We Start!\n",
    "\n",
    "1. Look at the instructions on the whiteboard.\n",
    "1. Github repository for these notebooks: **github.com/ericmjl/Network-Analysis-Made-Simple/**\n",
    "    1. Please clone the repository if you'd like to do the hands-on coding activities.\n",
    "1. Some of the coding activities are going to be hard! Be ready to discuss the problem with your fellow Pythonistas, or even better, **pair code**.\n",
    "1. If you are using legacy Python, you may wish to pair up."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "# Quiz!\n",
    "\n",
    "In the list comprehension:\n",
    "\n",
    "    [s for s in my_fav_things if s[‘name’] == ‘raindrops on roses’]\n",
    "    \n",
    "What are a plausible data structure for `s` and `my_fav_things`?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "my_fav_things = []\n",
    "my_fav_things.append({'name': 'raindrops on roses', 'line': 1})\n",
    "my_fav_things.append({'name': 'whiskers on kittens', 'line': 1})\n",
    "my_fav_things.append({'name': 'bright copper kettles', 'line': 2})\n",
    "\n",
    "[s for s in my_fav_things if s['name'] == 'raindrops on roses']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "# Prerequisites\n",
    "\n",
    "Use the `checkenv.py` script provided in the repository to determine whether you need to install any new dependencies. You may do so while we quickly go through some background information."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Network Basics\n",
    "\n",
    "*All your relational problems are belong to networks.*\n",
    "\n",
    "Networks, a.k.a. graphs, are an immensely useful modelling tool to model complex relational problems. \n",
    "\n",
    "Networks are comprised of two main entities:\n",
    "\n",
    "- Nodes: commonly represented as circles. In the academic literature, nodes are also known as \"vertices\".\n",
    "- Edges: commonly represented as lines between circles"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "Edges denote relationships between the nodes. \n",
    "\n",
    "> The heart of a graph lies in its edges, not in its nodes.\n",
    "> (John Quackenbush, Harvard School of Public Health)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "In a network, if two nodes are joined together by an edge, then they are neighbors of one another.\n",
    "\n",
    "There are generally two types of networks - directed and undirected. In undirected networks, edges do not have a directionality associated with them. In directed networks, they do."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Examples of Networks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. Facebook's network: Individuals are nodes, edges are drawn between individuals who are FB friends with one another. **undirected network**.\n",
    "2. Air traffic network: Airports are nodes, flights between airports are the edges. **directed network**.\n",
    "\n",
    "Can you think of any others?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Take-Homes\n",
    "\n",
    "It is my hope that when you leave this tutorial, practically, you will be equipped to:\n",
    "\n",
    "- Use NetworkX to construct graphs in the Jupyter environment.\n",
    "- Visualize network data using node-link diagrams, heat maps, Circos plots and Hive plots.\n",
    "- Write basic algorithms to find structures and paths in a graph.\n",
    "- Compute network statistics."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "# Take-Homes (cont'd)\n",
    "\n",
    "From a broader perspective, I hope you will be able to:\n",
    "\n",
    "- Think in terms of \"interactions\" between entities, and not just think about the entities themselves.\n",
    "- Think through statistical problems in network analysis."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Tutorial Format\n",
    "\n",
    "- Student notebooks for coding exercises.\n",
    "- Instructor versions for reference.\n",
    "- Feel free to skip ahead of myself if I'm too slow for you."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "source": [
    "# Credits\n",
    "\n",
    "Much of this work is inspired by Prof. Allen Downey (Olin College of Engineering) and Prof. Jukka-Pekka Onnela (Harvard School of Public Health).\n",
    "\n",
    "Statistics methods are inspired by Dr. Jake Vanderplas, UW.\n",
    "\n",
    "Hive and Circos Plots' original inventor is Martin Krzywinsky of the BC Genome Sciences Center.\n",
    "\n",
    "Circos plots were implemented with help from Justin Zabilansky (MIT).\n",
    "\n",
    "Many thanks to the PyCon Rehearsal class for providing feedback on the material prior to PyCon 2015.\n",
    "\n",
    "Thank you all who attended actual iterations of this tutorial, at \n",
    "\n",
    "- SciPy 2016 & 2017 (Austin, TX)\n",
    "- PyCon 2016 & 2017 (Portland, OR)\n",
    "- PyCon 2015 (Montreal)\n",
    "- Data Science for Social Good (Boston)\n",
    "- PyData NYC 2015 (New York City)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "source": [
    "# The Data\n",
    "\n",
    "In this tutorial, we have a number of data sets that have been downloaded from the Konect network analysis repository.\n",
    "\n",
    "<!-- Todo: List the datasets here. -->"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "celltoolbar": "Slideshow",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "colors": {
    "hover_highlight": "#DAA520",
    "navigate_num": "#000000",
    "navigate_text": "#333333",
    "running_highlight": "#FF0000",
    "selected_highlight": "#FFD700",
    "sidebar_border": "#EEEEEE",
    "wrapper_background": "#FFFFFF"
   },
   "moveMenuLeft": true,
   "nav_menu": {
    "height": "192px",
    "width": "252px"
   },
   "navigate_menu": true,
   "number_sections": true,
   "sideBar": true,
   "threshold": 4,
   "toc_cell": false,
   "toc_section_display": "block",
   "toc_window_display": false,
   "widenNotebook": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
